home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_337 / cmanual / screens.lzh / Screens / Example3.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  3KB  |  106 lines

  1. /* Example3                                                              */
  2. /* This program will open a low-resolution, non-Interlaced, eight colour */
  3. /* Custom Screen. It will use the TOPAZ_SIXTY Italic style as default    */
  4. /* font.                                                                 */
  5.  
  6.  
  7.  
  8. /* If your program is using Intuition you should include intuition.h: */
  9. #include <intuition/intuition.h>
  10.  
  11.  
  12.  
  13. struct IntuitionBase *IntuitionBase;
  14.  
  15.  
  16.  
  17. /* Declare and initialize the TextAttr structure: */
  18. struct TextAttr my_font=
  19. {
  20.   "topaz.font", /* Font Name      Topaz */
  21.   TOPAZ_SIXTY,  /* Font Height    64/32 character, 9 lines tall */
  22.   FSF_ITALIC,   /* Style          Italic */
  23.   FPF_ROMFONT   /* Preferences    The font exist in ROM */
  24. };
  25.  
  26. /* Style:                                                */
  27. /*   FS_NORMAL      : Normal style.                      */
  28. /*   FSF_ITALIC     : Italic style.                      */
  29. /*   FSF_BOLD       : Bold style.                        */
  30. /*   FSF_UNDERLINED : Underlined.                        */
  31. /*   FSF_EXTENDED   : Extended style (wider than normal) */
  32. /* See file graphics/text.h for more information.        */
  33.  
  34.  
  35.  
  36. /* Declare a pointer to a Screen structure: */ 
  37. struct Screen *my_screen;
  38.  
  39. /* Declare and initialize your NewScreen structure: */
  40. struct NewScreen my_new_screen=
  41. {
  42.   0,            /* LeftEdge  Should always be 0. */
  43.   0,            /* TopEdge   Top of the display.*/
  44.   320,          /* Width     We are using a low-resolution screen. */
  45.   200,          /* Height    Non-Interlaced NTSC (American) display. */
  46.   3,            /* Depth     8 colours. */
  47.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  48.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  49.   NULL,         /* ViewModes No special modes. (Low-res, Non-Interlaced) */
  50.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  51.   &my_font,     /* Font      Topaz 60 (Italic style) font. */
  52.   "MY SCREEN",  /* Title     The screen' title. */
  53.   NULL,         /* Gadget    Must for the moment be NULL. */
  54.   NULL          /* BitMap    No special CustomBitMap. */
  55. };
  56.  
  57.  
  58.  
  59. main()
  60. {
  61.   /* Open the Intuition Library: */
  62.   IntuitionBase = (struct IntuitionBase *)
  63.     OpenLibrary( "intuition.library", 0 );
  64.   
  65.   if( IntuitionBase == NULL )
  66.     exit(); /* Could NOT open the Intuition Library! */
  67.   
  68.  
  69.  
  70.   /* We will now try to open the screen: */
  71.   my_screen = (struct Screen *) OpenScreen( &my_new_screen );
  72.   
  73.   /* The "(struct Screen *)" is not necessary but it tells the compiler */
  74.   /* that the function OpenScreen() returns a pointer to a Screen */
  75.   /* structure. (See chapter "Amiga C" for more information) */
  76.  
  77.   /* Have we opened the screen succesfully? */
  78.   if(my_screen == NULL)
  79.   {
  80.     /* Could NOT open the Screen! */
  81.     
  82.     /* Close the Intuition Library since we have opened it: */
  83.     CloseLibrary( IntuitionBase );
  84.  
  85.     exit();  
  86.   }
  87.  
  88.  
  89.  
  90.   /* We have opened the screen, and everything seems to be OK. */
  91.   /* Wait for 30 seconds: */
  92.   Delay( 50 * 30);
  93.  
  94.  
  95.  
  96.   /* We should always close the screens we have opened before we leave: */
  97.   CloseScreen( my_screen );
  98.  
  99.  
  100.   
  101.   /* Close the Intuition Library since we have opened it: */
  102.   CloseLibrary( IntuitionBase );
  103.   
  104.   /* THE END */
  105. }
  106.